export default {
    data() {
        return {
            id: 0,
        }
    },

    //进入页面加载
    mounted: function () {
        var that = this;
        //在缓存中获取值
        that.user_name = sessionStorage.getItem("user_name");
        that.user_id = sessionStorage.getItem("user_id");
        that.token = sessionStorage.getItem("access-token");
        if ((!that.token) || (!that.user_id) || (!that.user_name)) {
            that.$router.push('/login');
        }

        if (that.$route.query.student_id) {
            that.student_id = that.$route.query.student_id;
            that.detail();
        }

    },

    //方法
    methods: {
        //请求api
        submitForm(formName) {
            var that = this;

            that.$router.push({path: '/seller/student_audit'});
            // this.$refs[formName].validate((valid) => {
            //     if (valid) {
            //         if (that.brand_id === 0) {
            //             that.addCitySwiper();
            //         } else {
            //             that.editCitySwiper();
            //         }
            //     } else {
            //         console.log('error submit!!');
            //         return false;
            //     }
            // });
        },

        /**
         * 详情
         */
        detail: function () {
            var that = this;
            //请求的数据
            var formData = {};
            formData.token = that.token;
            formData.id = that.brand_id;

            //请求邀请者列表
            that.$http.post(that.adminApi.api_url + "/api/brands/show_edit", formData, {
                emulateJSON: true
            }).then(
                function (res) {
                    that.ruleForm.band = res.body.brand_id;
                    that.ruleForm.radio = res.body.status.toString();
                    that.ruleForm.sort = res.body.sort
                    that.imgList.push({
                        url: res.body.picture,
                    })
                },
                function () {
                    // 处理失败的结果
                    that.$message({
                        type: 'error',
                        message: `操作提示: ${ '处理异常' }`
                    });
                });
        },


        /**
         * 重新修改
         */
        revise: function () {
            var that = this;
            // that.$router.push({path: '/seller/student_info'});
            that.$router.push({path: '/seller/student',query:{student_id:that.student_id}});
        },

        /**
         * 返回
         */
        cancel: function () {
            var that = this;
            that.$router.push({path: '/seller/student'});
        },

    }
}